<template>
  <!-- 封装组件 -->
  <div class="userCell">
    <van-cell class="vanCell" center>
      <template #title>
        <div class="title">
          {{ title }}
        </div>
      </template>
      <template #default>
        <img
          class="img"
          v-if="type === 'img' && value"
          :src="baseUrl + value"
          alt=""
        />
        <img
          v-else-if="type === 'img' && !value"
          class="img"
          src="@/assets/logo.png"
          alt=""
        />
        <div v-else class="value">
          {{ value }}
        </div>
      </template>
      <template #right-icon>
        <i class="iconfont" v-html="icon"></i>
      </template>
    </van-cell>
  </div>
</template>

<script>
export default {
  props: ['title', 'icon', 'value', 'type'],
  data () {
    return {
      baseUrl: process.env.VUE_APP_Url
    }
  }
}
</script>

<style lang="less" scoped>
.userCell {
//   padding-top: 10px;
  .vanCell {
    height: 51px;
    line-height: 51px;
    border-bottom: 1px solid #f7f4f5;
    .title {
      //   text-align: left;
      font-family: MicrosoftYaHei;
      font-size: 16px;
      font-weight: normal;
      font-stretch: normal;
      letter-spacing: 0px;
      color: #333333;
    }
    .iconfont {
      padding-left: 5px;
      font-size: 16px;
      color: #cccccc;
    }
    .img {
      margin-top: 20px;
      width: 25px;
      height: 25px;
      line-height: 51px;
      border-radius: 50%;
    }
  }
}
</style>
